package Leetcode;
import tree.TreeNode;

import java.util.ArrayList;
import java.util.List;

/**
 * @ Author     ：侯耀祖
 * @ Description：
 */
public class kthSmallest {
    int res = 0;
    int count;
    public int kthSmallest(TreeNode root, int k) {
        count = k;
        small(root);
        return res;
    }
    public void small(TreeNode root){
        if (root == null){
            return;
        }
        small(root.left);
        count--;
        if (count == 0){
          res = root.val;
        }
        small(root.right);
    }
}
